/*
    <one line to give the library's name and an idea of what it does.>
    Copyright (C) 2015  <copyright holder> <email>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/


#ifndef SERIAL_H
#define SERIAL_H
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <linux/types.h>
#include <linux/videodev2.h>
#include <malloc.h>
#include <math.h>
#include <sys/mman.h>
#include <errno.h>
#include <assert.h>
#include <string.h>
#include <sys/time.h>
#include <linux/fb.h>
#include <time.h>
#include <iostream>
#include <fstream>
#include <string>
#include <termios.h> 
using namespace std;
class serial
{
private:
	int serial_fd;
	string device_file;
	struct termios serial_property;   //串口属性
	
	
	
public:
serial(){}
serial(string dev_file);
virtual ~serial();

public:
	void serial_open();     //打开设备
	void serial_colse();    //关设备
	void serial_seting(int speed,int bits,char event,int stopbit);   //设置串口
	void serial_send(string str);     //发送数据
	void serial_receive();  //接收数据
};

#endif // SERIAL_H
